//
//  Constant.h
//  jshop
//
//  Created by 张艳江 on 2019/4/29.
//  Copyright © 2019年 张艳江. All rights reserved.
//

#ifndef Constant_h
#define Constant_h

#ifdef DEBUG //调试

#define NSLog(FORMAT, ...) fprintf(stderr, "%s:%zd\t%s\n", [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String]);

#else // 发布

#define NSLog(FORMAT, ...) nil

#endif

#pragma mark ------- 定义屏幕宽度,比例------
#define kScreenH          ([UIScreen mainScreen].bounds.size.height)
#define kScreenW          ([UIScreen mainScreen].bounds.size.width)
#define kScale_W          (float)kScreenW/375.f
#define kScale_H          (float)kScreenH/667.f
#define kStatusBarHeight  [[UIApplication sharedApplication] statusBarFrame].size.height
#define kNavBarHeight     44.0
#define kTabBarHeight     ([[UIApplication sharedApplication] statusBarFrame].size.height>20?80:49)
#define kTopHeight        (kStatusBarHeight + kNavBarHeight)

#define SCFont(font)      [UIFont systemFontOfSize:(font)]
#define SCBFont(font)     [UIFont boldSystemFontOfSize:(font)]

#define Token             [[NSUserDefaults standardUserDefaults] objectForKey:@"token"]
#define Phone             [[NSUserDefaults standardUserDefaults] objectForKey:@"phone"]

#define ApplicationDelegate   ((AppDelegate *)[[UIApplication sharedApplication] delegate])
/** 弱引用 */
#define WeakSelf __weak __typeof(&*self)weakSelf = self;

//色值
#define RGBA(r,g,b,a)     [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b)        RGBA(r,g,b,1.0f)
#define BGColor           RGB(245, 245, 245)//全局背景色

// View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

// View 圆角加阴影
#define ViewRadiusAndShadow(View, Radius, Color)\
\
[View.layer setShadowColor:[Color CGColor]];\
[View.layer setShadowOffset:CGSizeMake(0, 0)];\
[View.layer setShadowOpacity:0.5];\
[View.layer setShadowRadius:3.0];\
[View.layer setCornerRadius:(Radius)];\

// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]

#define WEAKSELF __weak typeof(self) weakSelf = self
#define kScreenWidth  [UIScreen mainScreen].bounds.size.width
#define FIT_WIDTH [UIScreen mainScreen].bounds.size.width/375

#define KSelectBorderColor      [UIColor colorWithRed:255/255.0 green:152/255.0 blue:1/255.0 alpha:1]
#define KUnSelectBorderColor    [UIColor colorWithRed:239/255.0 green:239/255.0 blue:239/255.0 alpha:1]
#define KButtonColor            [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1]


#endif /* Constant_h */
